#include "st-texture-cache.h"
#include "st-theme-context.h"
#include "st-private.h"
+#include "st-image-content-private.h"
enum
{
PROP_ICON_SIZE,
PROP_FALLBACK_ICON_NAME,
+ PROP_IS_SYMBOLIC,
+
N_PROPS
};
GIcon *fallback_gicon;
gboolean needs_update;
gboolean is_themed;
+ gboolean is_symbolic;
StIconColors *colors;
g_value_set_string (value, st_icon_get_fallback_icon_name (icon));
break;
+ case PROP_IS_SYMBOLIC:
+ g_value_set_boolean (value, st_icon_get_is_symbolic (icon));
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
NULL,
ST_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
+ /**
+ * StIcon:symbolic:
+ *
+ * Whether the #StIcon is symbolic.
+ */
+ props[PROP_IS_SYMBOLIC] =
+ g_param_spec_boolean ("is-symbolic",
+ "Is Symbolic",
+ "Whether the icon is symbolic",
+ FALSE,
+ ST_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY);
+
g_object_class_install_properties (object_class, N_PROPS, props);
}
}
}
+static void
+st_icon_update_is_symbolic (StIcon *icon)
+{
+ StIconPrivate *priv = icon->priv;
+ gboolean is_symbolic = FALSE;
+ ClutterContent *content = NULL;
+
+ if (priv->icon_texture)
+ content = clutter_actor_get_content (priv->icon_texture);
+
+ if (ST_IS_IMAGE_CONTENT (content))
+ is_symbolic = st_image_content_get_is_symbolic (ST_IMAGE_CONTENT (content));
+
+ if (priv->is_symbolic != is_symbolic)
+ {
+ priv->is_symbolic = is_symbolic;
+ g_object_notify_by_pspec (G_OBJECT (icon), props[PROP_IS_SYMBOLIC]);
+ }
+}
+
static void
on_content_changed (ClutterActor *actor,
GParamSpec *pspec,
StIcon *icon)
{
st_icon_clear_shadow_pipeline (icon);
+ st_icon_update_is_symbolic (icon);
}
static void
g_object_unref (priv->icon_texture);
st_icon_clear_shadow_pipeline (icon);
+ st_icon_update_is_symbolic (icon);
g_signal_connect_object (priv->icon_texture, "notify::content",
G_CALLBACK (on_content_changed), icon, 0);
g_object_thaw_notify (G_OBJECT (icon));
}
+
+/**
+ * st_icon_get_is_symbolic:
+ * @icon: an #StIcon
+ *
+ * Returns: Whether the displayed icon is symbolic
+ */
+gboolean
+st_icon_get_is_symbolic (StIcon *icon)
+{
+ g_return_val_if_fail (ST_IS_ICON (icon), FALSE);
+
+ return icon->priv->is_symbolic;
+}
--- /dev/null
+/*
+ * st-image-content-private.h: Private StImageContent methods
+ *
+ * Copyright 2024 Red Hat, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU Lesser General Public License,
+ * version 2.1, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include "st-image-content.h"
+
+G_BEGIN_DECLS
+
+void st_image_content_set_is_symbolic (StImageContent *content,
+ gboolean is_symbolic);
+
+gboolean st_image_content_get_is_symbolic (StImageContent *content);
+
+G_END_DECLS
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "st-image-content.h"
+#include "st-image-content-private.h"
#include "st-private.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
{
int width;
int height;
+ gboolean is_symbolic;
};
enum
"preferred-height", height,
NULL);
}
+
+void
+st_image_content_set_is_symbolic (StImageContent *content,
+ gboolean is_symbolic)
+{
+ StImageContentPrivate *priv;
+
+ g_return_if_fail (ST_IS_IMAGE_CONTENT (content));
+
+ priv = st_image_content_get_instance_private (content);
+ priv->is_symbolic = is_symbolic;
+}
+
+gboolean
+st_image_content_get_is_symbolic (StImageContent *content)
+{
+ StImageContentPrivate *priv;
+
+ g_return_val_if_fail (ST_IS_IMAGE_CONTENT (content), FALSE);
+
+ priv = st_image_content_get_instance_private (content);
+ return priv->is_symbolic;
+}